﻿namespace zyn_hy_login
{
    using System;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;

    public class Scheck
    {
        private HttpCookieCollection ck;
        private HttpResponse hr;
        private Page pg;
        private string reStr;
        private string scStr;
        private HttpSessionState se;

        public Scheck()
        {
        }

        public Scheck(HttpSessionState se1, HttpCookieCollection ck1, HttpResponse hr1)
        {
            this.se = se1;
            this.ck = ck1;
            this.hr = hr1;
        }

        public Scheck(HttpSessionState se1, HttpCookieCollection ck1, HttpResponse hr1, Page pg1)
        {
            this.se = se1;
            this.ck = ck1;
            this.hr = hr1;
            this.pg = pg1;
        }

        public void goScriptAdmin()
        {
            if (this.se["aspuid"] == null)
            {
                this.pg.RegisterClientScriptBlock("01", this.scStr);
            }
            else if (this.se["aspugroup"].ToString() != "Administrators")
            {
                this.pg.RegisterClientScriptBlock("01", this.scStr);
            }
        }

        public void goScriptUser()
        {
            if (this.se["aspuid"] == null)
            {
                this.pg.RegisterClientScriptBlock("01", this.scStr);
            }
            else
            {
                string text2 = this.se["aspugroup"].ToString();
                if (((text2 != "Users") && (text2 != "Administrators")) && (text2 != "Power_Users"))
                {
                    this.pg.RegisterClientScriptBlock("01", this.scStr);
                }
            }
        }

        public void If_Login()
        {
            this.reStr = "../login.aspx?err=zyn_top";
            if (this.se["hy_num"] == null)
            {
                this.hr.Redirect(this.reStr);
            }
            if (this.ck["hy_hum"] == null)
            {
                this.hr.Redirect(this.reStr);
            }
        }

        public void Login_z8_admin()
        {
            this.reStr = "/z8/alert.aspx?z8_alert=noquanxian";
            if (this.se["aspuid"] == null)
            {
                this.hr.Redirect(this.reStr);
            }
            else if (this.se["aspugroup"].ToString() != "Administrators")
            {
                this.hr.Redirect(this.reStr);
            }
        }

        public void Login_z8_all()
        {
            this.reStr = "/z8/alert.aspx?z8_alert=noquanxian";
            if (this.se["aspuid"] == null)
            {
                this.hr.Redirect(this.reStr);
            }
        }

        public void Login_z8_Power_Users()
        {
            this.reStr = "/z8/alert.aspx?z8_alert=noquanxian";
            if (this.se["adpuid"] == null)
            {
                this.hr.Redirect(this.reStr);
            }
            else
            {
                string text2 = this.se["aspugroup"].ToString();
                if ((text2 != "Power_Users") && (text2 != "Administrators"))
                {
                    this.hr.Redirect(this.reStr);
                }
            }
        }

        public void Login_z8_user()
        {
            this.reStr = "/z8/alert.aspx?z8_alert=login";
            if (this.se["yh_info"] == null)
            {
                this.hr.Redirect(this.reStr);
            }
            else
            {
                string text2 = this.se["aspugroup"].ToString();
                if (((text2 != "Users") && (text2 != "Administrators")) && (text2 != "Power_Users"))
                {
                    this.hr.Redirect(this.reStr);
                }
            }
        }

        public string ReStr
        {
            get
            {
                return this.reStr;
            }
            set
            {
                this.reStr = value;
            }
        }

        public string ScStr
        {
            get
            {
                return this.scStr;
            }
            set
            {
                this.scStr = value;
            }
        }
    }
}

